home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / GDIDIB.PAK / GLOBALS.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  9KB  |  203 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993 - 1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12. //-------------------------------------------------------------------------
  13. // Product identifier string defines
  14.  
  15. //  **TODO** Change these strings to the name of your application.
  16.  
  17.     #define APPNAME       GDIDIB
  18.     #define ICONFILE      GDIDIB.ICO
  19.     #define SZAPPNAME     "GDIDIB"
  20.     #define SZDESCRIPTION "GDIDIB Example Application"
  21.     #define SZABOUT       "About GDIDIB"
  22.     #define SZVERSION     "Version 4.0"
  23.  
  24.  
  25. //-------------------------------------------------------------------------
  26. // Functions for handling main window messages.  The message-dispatching
  27. // mechanism expects all message-handling functions to have the following
  28. // prototype:
  29. //
  30. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  31.  
  32. // **TODO**  Add message-handling function prototypes here.  Be sure to
  33. //           add the function names to the main window message table in
  34. //           gdidib.c.
  35.  
  36. LRESULT MsgCommand            (HWND, UINT, WPARAM, LPARAM);  // gdidib.c   
  37. LRESULT MsgClose              (HWND, UINT, WPARAM, LPARAM);
  38. LRESULT MsgDestroy            (HWND, UINT, WPARAM, LPARAM);
  39. LRESULT MsgCreate             (HWND, UINT, WPARAM, LPARAM);
  40. LRESULT MsgSize               (HWND, UINT, WPARAM, LPARAM);
  41. LRESULT MsgPaletteChanged     (HWND, UINT, WPARAM, LPARAM);
  42. LRESULT MsgQueryNewPalette    (HWND, UINT, WPARAM, LPARAM);
  43. LRESULT MsgQueryEndSession    (HWND, UINT, WPARAM, LPARAM);
  44. LRESULT MsgNotify             (HWND, UINT, WPARAM, LPARAM);  // toolbar.c
  45. LRESULT MsgTimer              (HWND, UINT, WPARAM, LPARAM);  // statbar.c
  46. LRESULT MsgMenuSelect         (HWND, UINT, WPARAM, LPARAM);
  47.  
  48. //-------------------------------------------------------------------------
  49. // Functions for handling main window commands--ie. functions for
  50. // processing WM_COMMAND messages based on the wParam value.
  51. // The message-dispatching mechanism expects all command-handling
  52. // functions to have the following prototype:
  53. //
  54. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  55.  
  56. // **TODO**  Add message-handling function prototypes here.  Be sure to
  57. //           add the function names to the main window command table in
  58. //           gdidib.c.
  59.  
  60. LRESULT CmdExit       (HWND, WORD, WORD, HWND);     // gdidib.c
  61. LRESULT CmdAbout      (HWND, WORD, WORD, HWND);     // about.c 
  62. LRESULT CmdInfo       (HWND, WORD, WORD, HWND);     // infodlg.c
  63. LRESULT CmdNew        (HWND, WORD, WORD, HWND);     // filedlg.c
  64. LRESULT CmdOpen       (HWND, WORD, WORD, HWND);
  65. LRESULT CmdSave       (HWND, WORD, WORD, HWND);
  66. LRESULT CmdClose      (HWND, WORD, WORD, HWND);
  67. LRESULT CmdPrint      (HWND, WORD, WORD, HWND);     // print.c  
  68. LRESULT CmdPageSetup  (HWND, WORD, WORD, HWND);
  69. LRESULT CmdPrintSetup (HWND, WORD, WORD, HWND);
  70.  
  71. LRESULT CmdDrawMode   (HWND, WORD, WORD, HWND);     // client.c
  72. LRESULT CmdFill       (HWND, WORD, WORD, HWND);
  73. LRESULT CmdCreatePen  (HWND, WORD, WORD, HWND);
  74. LRESULT CmdCreateBrush(HWND, WORD, WORD, HWND);
  75. LRESULT CmdClear      (HWND, WORD, WORD, HWND);     // gdidib.c
  76.  
  77.  
  78. //-------------------------------------------------------------------------
  79. // Global function prototypes.
  80.  
  81. // **TODO**  Add global function prototypes here.
  82.  
  83. BOOL    InitApplication(HINSTANCE, int);     // init.c
  84. BOOL    CenterWindow(HWND, HWND);            // misc.c
  85. void    SetWindowTitle(HWND, LPSTR);         // misc.c 
  86. void    InitDIBSection(HWND);                // misc.c
  87. void    RemoveDIBSection(void);              // misc.c
  88. HWND    CreateClientWindow(HWND);            // client.c
  89. void    SizeClientWindow(HWND);              // client.c  
  90. void    InitDrawObjects(void);               // client.c
  91. int     QuerySaveChanges(HWND);              // filedlg.c
  92. HBITMAP LoadDIBSection(HWND, LPSTR);         // fileio.c
  93.  
  94.  
  95. // Callback functions.  These are called by Windows.
  96.  
  97. // **TODO**  Add new callback function prototypes here.  
  98.  
  99. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);       // gdidib.c
  100. LRESULT CALLBACK ClientWndProc(HWND, UINT, WPARAM, LPARAM); // client.c
  101.  
  102. //-------------------------------------------------------------------------
  103. // Global variable declarations.
  104.  
  105. extern HINSTANCE hInst;          // The current instance handle
  106. extern char      szAppName[];    // The name of this application
  107. extern HWND      hWndClient;     // The Client window
  108. extern HMENU     hMenu;          // Application menu
  109. extern HICON     hIcon;          // Application icon
  110.                 
  111. // palette-related globals
  112. extern HPALETTE  hPalette;       // App's logical palette
  113. extern BOOL      bPalDevice;     // palette device flag
  114.  
  115. // drawing-related globals
  116. extern LOGPEN    logPen;         // structure for pen attributes
  117. extern LOGBRUSH  logBrush;       // structure for brush attributes
  118.  
  119. // DIB section-related globals
  120. extern char      szCurrentFile[]; 
  121. extern HBITMAP   hBitmap;
  122. extern HANDLE    hDIBInfo;
  123. extern LPVOID    lpvBits;
  124. extern BOOL      fChanges;
  125.                                     
  126.  
  127. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  128. //           line 2.  For MDI applications, uncomment line 2 below, comment
  129. //           line 1, and then define hwndMDIClient as a global variable in
  130. //           INIT.C
  131. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  132. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  133.  
  134.  
  135. //-------------------------------------------------------------------------
  136. // Message and command dispatch infrastructure.  The following type
  137. // definitions and functions are used by the message and command dispatching
  138. // mechanism and do not need to be changed.
  139.  
  140.     // Function pointer prototype for message handling functions.
  141. typedef LRESULT (*PFNMSG)(HWND, UINT, WPARAM, LPARAM);
  142.  
  143.     // Function pointer prototype for command handling functions.
  144. typedef LRESULT (*PFNCMD)(HWND, WORD, WORD, HWND);
  145.  
  146.     // Enumerated type used to determine which default window procedure
  147.     // should be called by the message- and command-dispatching mechanism
  148.     // if a message or command is not handled explicitly.
  149. typedef enum
  150. {
  151.    edwpNone,            // Do not call any default procedure.
  152.    edwpWindow,          // Call DefWindowProc.
  153.    edwpDialog,          // Call DefDlgProc (This should be used only for
  154.                         // custom dialogs - standard dialog use edwpNone).
  155.    edwpMDIChild,        // Call DefMDIChildProc.
  156.    edwpMDIFrame         // Call DefFrameProc.
  157. } EDWP;                // Enumeration for Default Window Procedures
  158.  
  159.     // This structure maps messages to message handling functions.
  160. typedef struct _MSD
  161. {
  162.     UINT   uMessage;
  163.     PFNMSG pfnmsg;
  164. } MSD;                 // MeSsage Dispatch structure
  165.  
  166.     // This structure contains all of the information that a window
  167.     // procedure passes to DispMessage in order to define the message
  168.     // dispatching behavior for the window.
  169. typedef struct _MSDI
  170. {
  171.     int  cmsd;          // Number of message dispatch structs in rgmsd
  172.     MSD *rgmsd;         // Table of message dispatch structures
  173.     EDWP edwp;          // Type of default window handler needed.
  174. } MSDI, FAR *LPMSDI;   // MeSsage Dipatch Information
  175.  
  176.     // This structure maps command IDs to command handling functions.
  177. typedef struct _CMD
  178. {
  179.     WORD   wCommand;
  180.     PFNCMD pfncmd;
  181. } CMD;                 // CoMmand Dispatch structure
  182.  
  183.     // This structure contains all of the information that a command
  184.     // message procedure passes to DispCommand in order to define the
  185.     // command dispatching behavior for the window.
  186. typedef struct _CMDI
  187. {
  188.     int  ccmd;          // Number of command dispatch structs in rgcmd
  189.     CMD *rgcmd;         // Table of command dispatch structures
  190.     EDWP edwp;          // Type of default window handler needed.
  191. } CMDI, FAR *LPCMDI;   // CoMmand Dispatch Information
  192.  
  193.     // Message and command dispatching functions.  They look up messages
  194.     // and commands in the dispatch tables and call the appropriate handler
  195.     // function.
  196. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  197. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  198.  
  199.     // Message dispatch information for the main window
  200. extern MSDI msdiMain;
  201.     // Command dispatch information for the main window
  202. extern CMDI cmdiMain;
  203.